<h1 class="cm-success-title">Thanks for joining the CASH Family.</h1>
{{#has_password}}
    <p class="cm-success">It looks like you already have a CASH Music login. If you want to reset your password use the form below. Otherwise just
        <a href="#" class="existing-user">click here</a> to continue.</p>
{{/has_password}}
{{^has_password}}
    <p class="cm-success">Set a password below for your account to login!</p>
{{/has_password}}
{{#error_message}}<div class="cm-error">{{error_message}}</div>{{/error_message}}
<form action="#" id="updatecredentials" method="post">
    <input type="text" class="cm-subcription-email" name="email" placeholder="email" value="{{email_address}}">
    <input type="password" class="cm-subcription-password" name="password" placeholder="password">
    <input type="password" class="cm-subcription-confirm-password" name="confirm_password" placeholder="confirm password">
    <input type="hidden" name="cash_request_type" value="commerce">
    <input type="hidden" name="cash_action" value="initiatesubscription">
    <input type="hidden" name="state" value="set_credentials">
    <button class="cm-update-settings">Save settings</button>
</form>

<script type="text/javascript">

    var cm = window.cashmusic;
    cm.events.add(cm,'ready', function(e) {
        cm.session.start();
        var click_here = document.querySelector('.existing-user');

        if (click_here) {
            cm.events.add(click_here, 'click', function (e) {
                e.preventDefault();
                cm.overlay.reveal({"element":"{{element_id}}","endpoint":"{{public_url}}","state":"logged_in_index"});
            });
        }
/*        if (update_settings_button) {
            cm.events.add(update_settings_button, 'click', function (e) {
                e.preventDefault();
                var f = document.getElementById('updatecredentials');

                console.log(cm.ajax.encodeForm(f));

                /!*
                var requesturl = '{{api_url}}/verbose/commerce/editcartshipping/element_id/{{element_id}}/region/' + this.value + '/session_id/{{session_id}}';
			requesturl += '?ts=' + new Date().getTime();
			cm.ajax.send(requesturl, false,
				function() {
					recount();
				}
			);
                 *!/
            });
        }*/

    });

</script>